home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
flagbi.arc
/
FLAGBIG.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1989-10-10
|
6KB
|
194 lines
{$A+,B-,D+,E+,F-,I+,L+,N-,O+,R+,S+,V+}
{$M 16384,0,1600}
PROGRAM FLAGBIG;
(* THIS PROGRAM RECURSIVELY SEARCHES AN ENTIRE VOLUME ON NETWARE AND FLAGS *)
(* FILES LARGER THAN A CERTAIN SIZE WITH THE "INDEX" FLAG. FLAGGED FILES *)
(* WILL HAVE THEIR FAT TABLES INDEXED AUTOMATICALLY BY NOVELL. *)
(* YOU MAY SPECIFY THE MINIMUM SIZE FOR FLAGGING ON THE COMMAND LINE OR *)
(* SELECT THE DEFAULT OF 500,000 BYTES. *)
(* All software is copyrighted by Azatar MicroSystems *)
(* and Lee Drake. Code for this example may be copied *)
(* for non-commercial applications as long as this notice *)
(* is included in the header. All commercial use is *)
(* specifically excluded. *)
USES DOS,CRT,ENGINE ;
CONST DEFAULT_MIN_FILE_SIZE : LONGINT = 500000;
VAR ERR : INTEGER; { temporary error vars }
ERR2: BYTE; { temporary error vars }
{$F+} PROCEDURE FLAGIT(VAR S : SEARCHREC; P:PATHSTR); {$F-}
(* This procedure, called by searchengineall, is the main procedure to *)
(* flag or unflag the files. Index_on is a byte with the proper bit *)
(* screen to turn on indexing when "or"ed with the current ext. attr. *)
(* byte. Index_off is the correct screen to use to turn off indexing *)
(* when "and"ed with the current byte. *)
(* NOTE - The format of the passed parameters above is fixed and cannot*)
(* be changed without changing the definitions for PROCTYPE in engine. *)
const index_on = $20;
index_off= $df;
VAR PZSTR : ARRAY [1..255] OF CHAR; {used to pass in the file path}
TEMPSTR : STRING; {Temporary Variable}
CH : CHAR; { " " }
INDEX_BIT : BYTE; { " " }
REGS : REGISTERS; { " " }
I : BYTE; { " " }
EFA : BYTE; {used to hold the Ext File Attr}
BEGIN
{Don't want to look at or change directories}
if (s.attr and directory) <> 0 then exit;
IF S.SIZE < DEFAULT_MIN_FILE_SIZE THEN INDEX_BIT := index_off else
INDEX_BIT := index_on;
TEMPSTR := P+S.NAME; {join the path and file name}
I := LENGTH(TEMPSTR); {Copy the path and file name}
WHILE (I > 0) DO {into the array }
BEGIN
PZSTR[I] := TEMPSTR [I];
DEC(I);
END;
PZSTR[LENGTH(TEMPSTR)+1] := #0; {Append an Ascii zero to the end}
{ GET CURRENT EXTENDED FILE ATTRIBUTES }
WITH REGS DO
BEGIN
AH := $B6;
AL := $00; {get extended attribute}
DS := SEG (PZSTR);
DX := OFS (PZSTR);
END;
MSDOS (REGS);
IF REGS.AL <> 0 THEN
begin
{ Get extended attributes failed }
writeln('Failed to get attributes');
ch := readkey;
EXIT;
end;
IF S.SIZE < DEFAULT_MIN_FILE_SIZE THEN
begin
{If size smaller and index off then exit}
if (regs.cl and index_on) = 0 then exit
else
{Size is smaller and index on, turn off?}
begin
write ('SET OFF: ',tempstr : 40,' ',s.size:9,'? ');
REPEAT
CH := UPCASE(READKEY);
UNTIL CH IN ['Y','N'];
IF CH = 'Y' THEN EFA := (REGS.CL and INDEX_BIT)
ELSE
begin
writeln ('ON':5);
EXIT;
end;
end;
end
ELSE
BEGIN
if (regs.cl and index_on) = 0 then
{it is not already on, turn it on?}
begin
WRITE ('SET ON : ',TEMPSTR : 40,' ',s.size:9,'? ');
REPEAT
CH := UPCASE(READKEY);
UNTIL CH IN ['Y','N'];
IF CH = 'Y' THEN EFA := (REGS.CL OR INDEX_BIT)
ELSE
begin
writeln('OFF':5);
EXIT;
end;
end
else
begin
{It is bigger but already on, just list it}
Writeln ('FILE : ',tempstr : 40,' ',s.size:9,': ALREADY ON');
exit;
end;
END;
{SET ATTRIBUTE BACK WITH INDEX BIT ON}
WITH REGS DO
BEGIN
AH :=$B6;
AL :=$01; {set extended attribute}
DS := SEG(PZSTR);
DX := OFS(PZSTR);
CL := EFA;
END;
MSDOS(REGS);
WITH REGS DO
IF ((FLAGS AND FCARRY) = 0) THEN
begin
if index_bit = index_on then WRITELN ('ON':5)
else writeln ('OFF':5);
end
ELSE IF (AL <> 0) THEN WRITELN ('FAIL:':5,AL);
END;
BEGIN
CLRSCR;
Writeln ('FLAGBIG - Copyright 1989, Azatar MicroSystems and Lee Drake');
writeln (' All rights reserved. Permission given for ');
writeln (' non-commercial use only. This is a share- ');
writeln (' ware program. If you find it useful please');
writeln (' Send $5 to Azatar MicroSystems, 3300 Monroe');
writeln (' Avenue, Rochester, NY 14618. ');
writeln (' Any copies of this program must include ');
writeln (' this message in it''s entirety ');
writeln;
writeln ('USAGE: FLAGBIG [#######] ');
writeln (' Where ####### = the cutoff point for file ');
writeln (' size. ');
writeln ('Program written in Turbo Pascal 5.5. ');
err := 0;
IF PARAMCOUNT > 0 THEN VAL(PARAMSTR(1),DEFAULT_MIN_FILE_SIZE,ERR);
IF ERR <> 0 THEN DEFAULT_MIN_FILE_SIZE := 500000;
Writeln ('Cutoff point = ',default_min_file_size);
{Note path could be passed in. Right now uses default drive and all}
{files on the drive. }
searchengineall ( '\','*.*',ANYFILE,FLAGIT,ERR2);
SEARCHERRORMESSAGE (ERR2);
END.